import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei', 'Microsoft YaHei', 'WenQuanYi Micro Hei', 'STHeiti', 'Songti SC', 'sans-serif']
plt.rcParams['axes.unicode_minus'] = False
import numpy as np

# 创建数据
x = np.linspace(0, 10, 100)
y = np.sin(x)

# 创建图形和子图
fig, ax = plt.subplots()

# 绘制折线图
ax.plot(x, y, label='sin(x)')

# 添加标题和标签
ax.set_title('正弦函数示例')
ax.set_xlabel('x轴')
ax.set_ylabel('y轴')

# 添加图例
ax.legend()

# 显示图形
plt.show()